package com.bwie.controller;

import com.bwie.common.domain.User;
import com.bwie.common.domain.request.UserLoginReq;
import com.bwie.common.domain.response.UserLoginResp;
import com.bwie.common.result.Result;
import com.bwie.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @className: AuthController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 李明
 * @date: 2025/11/10 9:35
 */
@RestController
@CrossOrigin
public class AuthController {

    @Autowired
    private AuthService authService;


    /**
     * 登录功能
     */
    @PostMapping("doLogin")
    public Result<UserLoginResp> doLogin(@RequestBody UserLoginReq userLoginReq){
        UserLoginResp userLoginResp = authService.doLogin(userLoginReq);
        return Result.success(userLoginResp);
    }


    /**
     * 获取登录人信
     */
    @GetMapping("getUser")
    public Result<User> getUser(){
        User user = authService.getUser();
        return Result.success(user);
    }

}
